package org.ling.xuan.entity.row;

import cn.hutool.core.collection.CollUtil;
import org.ling.xuan.entity.mo.LocalAdd;
import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;

public class LocalAddRowMapper implements RowMapper<LocalAdd> {
    public static LocalAddRowMapper INSTANCE = new LocalAddRowMapper();

    private LocalAddRowMapper() {
    }

    @Override
    public LocalAdd mapRow(ResultSet rs, int rowNum) throws SQLException {
        LocalAdd localAdd = new LocalAdd();
        localAdd.setId(rs.getString("id"));
        localAdd.setModifyId(rs.getString("modify_id"));
        localAdd.setCtdTime(rs.getTimestamp("ctd_time"));
        localAdd.setAddMsg(rs.getString("add_msg"));
        localAdd.setSend(rs.getBoolean("send"));
        localAdd.setBankCode(rs.getString("bank_code"));
        localAdd.setModifyVersion(rs.getString("modify_version"));
        localAdd.setRequireBank(rs.getString("require_bank"));
        localAdd.setRequirementId(rs.getString("requirement_id"));
        localAdd.setRequirementDes(rs.getString("requirement_des"));
        localAdd.setCommited(rs.getBoolean("commited"));
        localAdd.setRemark(rs.getString("remark"));
        String markFileIdsStr = rs.getString("mark_file_ids");
        localAdd.setDeployType(rs.getString("deploy_type"));
        localAdd.setSkipSql(rs.getBoolean("skip_sql"));
        if (markFileIdsStr != null && !markFileIdsStr.isEmpty()) {
            localAdd.setMarkFileIds(CollUtil.newArrayList(markFileIdsStr.split(",")));
        }
        localAdd.setCur(rs.getBoolean("cur"));
        localAdd.setDeleted(rs.getBoolean("deleted"));
        return localAdd;
    }
}







